-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dim check while calculating mIoU&pixAcc for segmentation test #991
base: master
Are you sure you want to change the base?
Conversation
Apologies for the new spaces, it was automatically modified by Pycharm IDE |
Job PR-991-1 is done. |
@@ -31,7 +31,7 @@ Table of pre-trained models for semantic segmentation and their performance. | |||
The test script :download:`Download test.py<../../scripts/segmentation/test.py>` can be used for | |||
evaluating the models (VOC results are evaluated using the official server). For example ``fcn_resnet50_ade``:: | |||
|
|||
python test.py --dataset ade20k --model-zoo fcn_resnet50_ade --eval | |||
python test.py --dataset ade20k --pretrained --model fcn --backbone resnet50 --eval |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello,
According in test.py
gluon-cv/scripts/segmentation/test.py
Line 20 in a78965f
def parse_args(): |
The args defined in parse_args() no longer has args 'model-zoo'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add that back instead. Not sure who removed that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether this may have conflicts with these settings.
gluon-cv/scripts/segmentation/test.py
Lines 204 to 230 in a78965f
model_prefix = args.model + '_' + args.backbone | |
if 'pascal' in args.dataset: | |
model_prefix += '_voc' | |
withQuantization = True if (args.backbone in ['resnet101']) else withQuantization | |
elif args.dataset == 'coco': | |
model_prefix += '_coco' | |
withQuantization = True if (args.backbone in ['resnet101']) else withQuantization | |
elif args.dataset == 'ade20k': | |
model_prefix += '_ade' | |
elif args.dataset == 'citys': | |
model_prefix += '_citys' | |
else: | |
raise ValueError('Unsupported dataset {} used'.format(args.dataset)) | |
if args.ngpus > 0: | |
withQuantization = False | |
if withQuantization and args.quantized: | |
model_prefix += '_int8' | |
if not args.deploy: | |
if args.calibration: | |
args.pretrained = True | |
# create network | |
if args.pretrained: | |
model = get_model(model_prefix, pretrained=True) | |
model.collect_params().reset_ctx(ctx=args.ctx) |
# the category -1 is ignored class, typically for background / boundary | ||
if len(output.shape) == 3: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batch_intersection_union
is supposed to work for a batch with 4D.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I'll try to modify from the dataset
Job PR-991-2 is done. |
@@ -120,7 +120,7 @@ def test(model, args, input_transform): | |||
tbar = tqdm(test_data) | |||
for i, (data, dsts) in enumerate(tbar): | |||
if args.eval: | |||
predicts = [pred[0] for pred in evaluator.parallel_forward(data)] | |||
predicts = [pred for pred in evaluator.parallel_forward(data)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect. The output of gluoncv segmentation network is always a list
The test.py example mentioned at
segmentation.rst
does not match the arguments mentioned in test.py
should probably be change to
python test.py --dataset ade20k --pretrained --model fcn --backbone resnet50 --eval
The dimension doesn't seem right when calculating the pixACC and mIoU
The output is 3D and the target is 2D
The safest way I could think of is to add a new axis if batch dim is missing.
Might have a better way to deal with.
Result after modification (without training)